// 仓库管理相关
import request from '@/utils/request'
// 查询全部仓库
export const getWareHouseList = () => request({
  url: '/api/warehouse/list'
})
// 分页查询仓库
export const getListByPage = (params) => request({
  url: '/api/warehouse/page',
  params
})
// 新增仓库
export const addWareHouse = (data) => request({
  url: '/api/warehouse',
  method: 'POST',
  data
})
// 修改仓库
export const mondifyWareHouse = (data) => request({
  url: '/api/warehouse',
  method: 'PUT',
  data
})
// 查询仓库
export const getWareHouse = (id) => request({
  url: `/api/warehouse/${id}`
})
// 删除仓库
export const delWareHouse = (ids) => request({
  url: `/api/warehouse?ids[]=${ids}`,
  method: 'DELETE'

})

// 库区相关

// 查询全部库区
export const getAreaList = (params) => request({
  url: 'api/area/list',
  params
})
// 分页查询库区
export const getAreaByPage = (params) => request({
  url: 'api/area/page',
  params
})
// 分页查询库区详细信息
export const getAreaInfoByPage = (params) => request({
  url: 'api/area/pageDetail',
  params
})

// 修改库区
export const mondifyArea = (data) => request({
  url: '/api/area',
  method: 'PUT',
  data
})
// 新增库区
export const addArea = (file) => request({
  url: 'api/area',
  method: 'POST',
  file
})
// 删除库区
export const delArea = (ids) => request({
  url: '/api/area',
  method: 'DELETE',
  ids
})
// 根据id查询库区
export const getAreaById = (id) => request({
  url: `api/area/${id}`
})
// 批量导入库区
export const importExcel = (data) => request({
  url: 'api/area/importExcel',
  method: 'POST',
  data
})
// 分页查询库位详细信息
export const getLocationDetail = (params) => request({
  url: 'api/location/pageDetail',
  params
})
// 新增库位
export const addLocation = (data) => request({
  url: 'api/location',
  method: 'POST',
  data
})
// 查询库区库位树
export const getTree = (params) => request({
  url: 'api/area/tree',
  params
})
// 根据id 查询库位
export const getLocationById = (id) => request({
  url: `api/location/${id}`
})
// 修改库位
export const mondifyLocation = (data) => request({
  url: 'api/location',
  method: 'PUT',
  data
})
